﻿/*
 * Autore: Paolo Farina, Artur Tolstenco
 */

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using RecipesManager.MainControls;
using RecipesManager.Data;


namespace RecipesManager
{
	public partial class MainMenu : ISwitchable, IMyUserControls
	{
	    IMyUserControls _actualUC = null;
        /* da chiedere a cosa serve? */

		public MainMenu()
		{
            
			InitializeComponent();

		}


		private void RicetteButton_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			Switcher.Switch(new RecipeUserControl());
		}

		private void EventiButton_click(object sender, System.Windows.RoutedEventArgs e)
		{
            		Switcher.Switch(new EventUserControl());
		}

        private void ListaSpesaButton_click(object sender, System.Windows.RoutedEventArgs e)
        {
            Switcher.Switch(new ShopListUserControl());
        }

		private void OspitiButton_click(object sender, System.Windows.RoutedEventArgs e)
		{
            Switcher.Switch(new GuestUserControl());
		}

        private void IngredientiButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            	   Switcher.Switch(new IngredientUserControl());
        }

        private void NegoziButton_click(object sender, System.Windows.RoutedEventArgs e)
        {
            	   Switcher.Switch(new ShopUserControl());
        }

        private void CategorieButton_click(object sender, System.Windows.RoutedEventArgs e)
        {
                  _actualUC = new CategoryUserControl();
            	  Switcher.Switch((CategoryUserControl)_actualUC);
        }

        #region ISwitchable Members
        public void UtilizeState(object state)
        {
            throw new NotImplementedException();
        }
        #endregion

        private void aggiorna_bd_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor=System.Windows.Input.Cursors.Wait;
            RecipesManager.Data.Manager.FillDatabase();
            Mouse.OverrideCursor = null;
        }


	    public bool Save_Context()
	    {
	        return true;
	    }

	    public void Bt_Back_Click(object sender, RoutedEventArgs e)
	    {

	    }

	    public void Bt_Delete_Click(object sender, RoutedEventArgs e)
	    {

	    }

	    public void Bt_Add_Click(object sender, RoutedEventArgs e)
	    {

	    }

	    public void Bt_Search_Click(object sender, RoutedEventArgs e)
	    {

	    }

	    public void Bt_Clear_Search_Click(object sender, RoutedEventArgs e)
	    {

	    }

	    public void Lb_Items_SelectionChanged(object sender, SelectionChangedEventArgs e)
	    {

	    }

	    public string SectionName { get; private set; }

        /*private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (Manager.Recipes.Contains("acqua calda"))
            {
                MessageBox.Show("La ricetta è già presente nel database.", "Errore",
                                 MessageBoxButton.OK,
                                 MessageBoxImage.Error);
                return;
            }

            var ricetta = Manager.Recipes.Add("acqua calda");
            var acqua = Manager.Ingredients["acqua"];
            ricetta.Ingredients.Add(acqua.Name, "Millilitri", 250);
            ricetta.Steps.AddGeneric("scaldare acqua");

            MessageBox.Show("Ricetta di prova aggiunta correttamente nel database.", "Avviso",
                             MessageBoxButton.OK,
                             MessageBoxImage.None);
        }*/
	}
}